//shunxuzhan
#include <stdio.h>
#define MAX_SIZE 5
typedef struct stack
{
    int stack[MAX_SIZE];
    int top;
}stack;
void main()
{
    stack st;
    init_stack(&st);
    if(is_empty(&st)==0)
        printf("empty\n");
    if(is_full(&st)==0)
        printf("full\n");
    int data;
    scanf("%d",&data);
    while(0==push_stack(&st,data))
    {
        scanf("%d",&data);
    }
    while(0==pop_stack(&st,&data))
    {
        printf("%d\n",data);
    }

}
//chushihua
int init_stack(stack *st)
{
    if(st==NULL)
    {
        return -1;
    }
    st->top=-1;
    return 0;
}
//panduankong
int is_empty(stack *st)
{
    if(st==NULL)
    {
        return -1;
    }
    if(st->top==-1)
    {
        return 0;
    }
    return -1;
}
int is_full(stack *st)
{
    if(st==NULL)
    {
        return -1;

    }
    if(st->top==MAX_SIZE-1)
    {
        return 0;
    }
    return -1;
}
//ruzhan
int push_stack(stack *st,int data)
{
    if(st==NULL||0==is_full(st))
    {
        return -1;
    }
    st->stack[++st->top]=data;
    return 0;
}
int pop_stack(stack *st,int *data)
{
    if(st==NULL||is_empty(st)==0)
    {
        return -1;
    }
    if(data!=NULL)
    {
        *data=st->stack[st->top--];
        
        return 0;
    }
    return -1;
}
